import static org.junit.Assert.*;
import org.junit.*;

/**
 * 
 * @author joncaddey
 * @version 1.0
 */
public class TestBattleMaster {

	private BattleMaster my_bm;
	private int[] my_unsorted_3_pips;

	@Before
	public void setup() {
		my_bm = new BattleMaster();
		my_unsorted_3_pips = new int[] { 1, 6, 4 };
	}

	/**
	 * dieAttack when unsorted attacker pips.
	 */
	@Test
	public void testUnsortedDieAttack() {
		my_bm.dieAttack(my_unsorted_3_pips, new int[] { 5 });
		assertEquals("lost an attacker", 0, my_bm.getAttackerCasualties());
		assertEquals("didn't lose defender", 1, my_bm.getDefenderCasualties());
	}

	/**
	 * dieAttack when both lose 1
	 */
	@Test
	public void testBothLoseOneDieAttack() {
		my_bm.dieAttack(my_unsorted_3_pips, new int[] { 6, 3 });
		assertEquals("wrong attackers lost", 1, my_bm.getAttackerCasualties());
		assertEquals("wrong defenders lost", 1, my_bm.getDefenderCasualties());
	}
	
	

}
